package edu.base.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.base.dao.CategoryMapper;
import edu.base.model.Category;
import edu.base.model.Statistics;

@Service
public class CategoryService {

	@Autowired
	CategoryMapper categoryMapper;
	
	
	public Integer insert(Category item) {
		return categoryMapper.insertSelective(item);
	}
	
	public void del(Integer id) {
		categoryMapper.deleteByPrimaryKey(id);
	}
	
	public void update(Category item) {
		categoryMapper.updateByPrimaryKeySelective(item);
	}
	
	public Category findByKey(Integer key) {
		return categoryMapper.selectByPrimaryKey(key);
	}

	public List<Category> query(Integer pid) {
		return categoryMapper.query(pid);
	}
	
	
	public List<Statistics> stat(){
		return categoryMapper.stat();
	}
}
